/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 thread.h

	$Header: /heroes4/thread.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( THREAD_H_INCLUDED )
#define THREAD_H_INCLUDED

#include "owned_ptr.h"
#include "sized_int_types.h"

// ------------------------------------------------------------
// encapsulate windows threads (avoiding includes of windows.h)
// ------------------------------------------------------------
class t_thread
{
public:
	t_thread();
	virtual ~t_thread();

	t_uint32         get_exit_code() const;
	bool             is_running() const;
	virtual t_uint32 run() = 0; // actual thread process
	void             start();   // start the thread
	void             stop( bool wait_for_end = true );
	void             wait_to_end();
protected:
	bool			 stop_requested() const;
private:
	struct t_data;

	t_owned_ptr<t_data> m_data;
};

#endif // THREAD_H_INCLUDED
